import os, time
import multiprocessing


def watch():
    # print(id(process), process)
    print("watch-id=", id(watch))
    print(__name__)  # __mp_main__
    for i in range(3):
        print("看电视....", os.getpid())
        time.sleep(1)


if __name__ == '__main__':  # __main__
    # 进程操作对象 = multiprocessing.Process(target=任务）
    # 任务可以是一个函数，也可以是一个方法
    print(__name__)
    print(os.getpid())
    print("watch-id=", id(watch))
    process = multiprocessing.Process(target=watch)
    print(id(process), process)
    process.start()  # 创建进程

"""
13169
看电视.... 13171
看电视.... 13171
看电视.... 13171
"""
